package com.touch.workshop.ui.scripteditor;
import javax.swing.*;
public class ScriptEditorMenuBar extends JMenuBar
{
	private static final long serialVersionUID = -6280563444692619923L;
	protected FileMenu FILE = new FileMenu();
	protected EditMenu EDIT = new EditMenu();
	
	public ScriptEditorMenuBar()
	{
		super();
		this.add(FILE);
		this.add(EDIT);
	}
	protected class FileMenu extends JMenu
	{	
		private static final long serialVersionUID = -442758990937519882L;
		protected JMenu NEW = new NewMenu();
		protected JMenuItem OPEN = new JMenuItem("Open");
		protected JMenuItem SAVE = new JMenuItem("Save");
		protected JMenuItem SAVEAS = new JMenuItem("Save As");		
	
		protected class NewMenu extends JMenu
		{
			private static final long serialVersionUID = -1235437003020573717L;
			protected JMenuItem SCRIPT = new JMenuItem("Script");
			protected JMenuItem BLOCK = new JMenuItem("Block");
			protected JMenuItem FUNCTION = new JMenuItem("Function");
			protected JMenuItem CLASS = new JMenuItem("Class");
			
			protected NewMenu()
			{
				super("New");
				this.add(SCRIPT);
				this.add(BLOCK);
				this.add(FUNCTION);
				this.add(CLASS);
				this.SCRIPT.addActionListener(ScriptHandlers.Script_Menu_Handler);
				this.BLOCK.addActionListener(ScriptHandlers.Script_Menu_Handler);
				this.FUNCTION.addActionListener(ScriptHandlers.Script_Menu_Handler);
				this.CLASS.addActionListener(ScriptHandlers.Script_Menu_Handler);				
			}
		}
		protected FileMenu()
		{
			super("File");
			this.add(NEW);
			this.add(OPEN);
			this.add(new JSeparator());
			this.add(SAVE);
			this.add(SAVEAS);		
						
			this.OPEN.addActionListener(ScriptHandlers.Script_Menu_Handler);
			this.SAVE.addActionListener(ScriptHandlers.Script_Menu_Handler);
			this.SAVEAS.addActionListener(ScriptHandlers.Script_Menu_Handler);			
		}
	}
	protected class EditMenu extends JMenu
	{
		private static final long serialVersionUID = -5194997403522560936L;
		protected JMenuItem UNDO = new JMenuItem("Undo");
		protected JMenuItem REDO = new JMenuItem("Redo");
		protected JMenuItem CUT = new JMenuItem("Cut");
		protected JMenuItem COPY = new JMenuItem("Copy");
		protected JMenuItem PASTE = new JMenuItem("Paste");
		
		protected EditMenu()
		{
			super("Edit");
			this.add(UNDO);
			this.add(REDO);
			this.add(new JSeparator());
			this.add(CUT);
			this.add(COPY);
			this.add(PASTE);
			
			this.UNDO.addActionListener(ScriptHandlers.Script_Menu_Handler);
			this.REDO.addActionListener(ScriptHandlers.Script_Menu_Handler);
			this.CUT.addActionListener(ScriptHandlers.Script_Menu_Handler);
			this.COPY.addActionListener(ScriptHandlers.Script_Menu_Handler);
			this.PASTE.addActionListener(ScriptHandlers.Script_Menu_Handler);
		}	
	}

}




